home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1432_data_type_storage_sizes.rtf < prev    next >
Text File  |  1993-11-08  |  4KB  |  104 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f3\fmodern Ohlfs;}
  2. \paperw12400
  3. \paperh9240
  4. \margl120
  5. \margr1000
  6. {\colortbl;\red0\green0\blue0;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  How many bytes of storage do the various fundamental data types take in the NEXTSTEP implementation?\
  8. \
  9. Q: What are the maximum and minimum values for the various arithmetic data types?\
  10. \
  11. A:  \
  12. \
  13.     TYPE            SIZE            MINIMUM      MAXIMUM\
  14.  
  15. \b     char
  16. \b0             1 byte = 8 bits        -128          127\
  17.  
  18. \b     unsigned char
  19. \b0         1 byte = 8 bits        0          255\
  20.  
  21. \b     short
  22. \b0             2 bytes = 16 bits        
  23. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 -32768
  24. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1           
  25. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 3276
  26. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 7\
  27.  
  28. \b     unsigned short
  29. \b0         2 bytes = 16 bits        0          
  30. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 65535
  31. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  32.  
  33. \b     int
  34. \b0             4 bytes = 32 bits        
  35. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 -2147483648
  36. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0       
  37. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 2147483647
  38. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  39.  
  40. \b     long    
  41. \b0         4 bytes = 32 bits        
  42. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 -2147483648
  43. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0       
  44. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 2147483647
  45. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  46.  
  47. \b     unsigned int
  48. \b0     
  49. \b     
  50. \b0 4 bytes = 32 bits        0          
  51. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 4294967295
  52. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  53.  
  54. \b     unsigned long        
  55. \b0 4 bytes = 32 bits        0          
  56. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 4294967295
  57. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  58.  
  59. \b     float        
  60. \b0      4 bytes = 32 bits        
  61. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 1.17549435e-38f
  62. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0   
  63. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 3.40282347e+38f
  64. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  65.  
  66. \b     double
  67. \b0             8 bytes = 64 bits        
  68. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 2.225073858507201e-308
  69. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc1\cf1 \
  70.                               
  71. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\fc1\cf1 1.797693134862316e+308
  72. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\fc0\cf0 \
  73. \
  74.  
  75. \fi-980\li980 •    The 
  76. \b unsigned
  77. \b0  and 
  78. \b signed 
  79. \b0 keywords don't change the size of the type they qualify.  \
  80. •    Pointers occupy 4 bytes.\
  81. •    The 
  82. \b void 
  83. \b0 type occupies no space.  \
  84.  
  85. \fi0\li0 \
  86. If you happen to forget any of the sizes, you can quickly remind yourself by running gdb and typing:\
  87. \
  88.  
  89. \f1\fs24\fc1\cf1     print sizeof(type)\
  90.  
  91. \f0\fs28\fc0\cf0     
  92. \fc1\cf1 \
  93. The minimum and maximum values are defined as constants in 
  94. \b <limits.h>
  95. \b0  and 
  96. \b <float.h>
  97. \b0 .\
  98. \
  99. QA808\
  100. \
  101. Valid for 1.0, 2.0, 3.0\
  102. \
  103.  
  104.